The invention relates to a method for implementing a real time control program in a non-real time operating system and to an apparatus for performing such a method.
Controlling systems are employed in an increasing extent in personal computers ("PCs") to achieve automation of machines and production plants. The essential advantage of PC-based controlling systems compared to prior art stored-program control solutions (SPS/CNC) is the possibility to use commonly effective computer standards which are pre-set by international norms and which have been very successful in use. Consequently, on the one side a cost saving control solution is provided. On the other side, the use of the most recent PC technique caused by the short innovation cycles in PC development is ensured.
As a first step to use PCs for automation systems, special PC assemblies are integrated into known SPS/CNC-control systems. However, the use of additional external PCs, in particular for displaying and listing of control operations, results in costly and expensive control systems.
A more promising approach for the use of PCs for controlling operations is the integration of SPS/CNC functions into the PCs themselves. The extremely fast and continuous increase of the capability of PC processors in the recent years made it possible to simultaneously carry out controlling operations in real time, i.e., the processing of information at the same time and with the same speed as they occur, and to manage usual PC functions by means of a single processor. This solution enables cost saving as well as an improved flexibility to adapt the control operation to the desired applications.
To perform real time control operations by means of a PC, it is necessary to provide all occurring tasks with a sufficient calculating time to enable stable process control. In detail, cyclic processing of a control task has to be performed without any time fluctuation, i.e., with a jitter in the range of a some microseconds and a predictable latency time, i.e., a response time of the controlling device on a control demand.
Under ideal conditions no additional operating system for real time tasks has to be implemented on the PC but the operating system implemented to carry out the usual PC functions simultaneously performs the real time control. However, almost no known operating system meets the above-mentioned real time requirements. This applies in particular to the standard operation systems for PCs produced by Microsoft. The Windows operating systems, in particular, are not suitable for real time tasks because interruption calls occurring in these operating systems do not have a direct access to the PC processor. In case a Windows operating system should execute a control task on a PC processor, a virtual computer management system retrieves a resource allocation of the processor after the interrupt call. This intermediate virtualising, however, substantially increases the latency time, in particular in case interrupts having a higher priority stop than a previous interrupt call. Moreover, the stability of the latency time of Windows operating systems, which is essential for control tasks, is not guaranteed because said operating systems have a reaction time depending on the kind of interrupt call. Since Windows operating systems, however, are the platforms having the largest application software supply, it would be desirable to carry out real time tasks when operating such operating systems.
From DE 44 06 094 A1 it is known to ensure the real time performance of a control program by carrying out a complete change of environment from the non-real time operating system to the real time control system by means of a direct access to a non-maskable interrupt (NMI) of the processor. This change of environment by means of the non-maskable interrupt requires an additional hardware for the PC system to generate the calls of the non-maskable interrupt. Moreover, the method according to DE 44 06 094 A1 does not have any information on the current condition of the operating system to that this operating system also stops critical code segments which have to be processed without any break to avoid instabilities of the operating systems. This applies in particular if the method according to DE 44 06 094 A1 is used for the operating system Windows NT which is most suitable for complex automation operations. This operating system uses the non-maskable interrupt for "fatal" hardware errors of the processor. The call of a non-maskable interrupt provides therefore a stop condition including a system status signal. Since the operating system kernel of Windows NT always expects a stop condition when calling the non-maskable interrupt, the use of said non-maskable interrupt to perform change of environment in order to achieve real time operation is not advisable. Finally, the method according to DE 44 06 094 A1 only determines the entry into the operating system by means of the non-maskable interrupt. However, no defined end of the control program is provided so that in the worst case no run time is left over for the operating system until the next call of the control program.